package com.shipwe.loans.ui.presenter

import com.shipwe.loans.R
import com.shipwe.loans.pro.ShipwePresenter
import com.shipwe.loans.ui.view.IMenuView
import org.json.JSONObject

/**
 * Shipwe
 * @Author wwdeng
 * @CreateTime: 2024/11/11 16:02
 * @Annotation：菜单
 */
class MenuPresenter(private val iView: IMenuView): ShipwePresenter(iView) {

    private val menuStr = arrayListOf(
        getString(R.string.menu_ask_us),
        getString(R.string.menu_personal_profile),
        getString(R.string.menu_advice),
        getString(R.string.menu_privacy_policy),
        getString(R.string.menu_setting),
        getString(R.string.menu_exit)
    )
    private val menuIcon = arrayListOf(
        R.drawable.page_menu_ask_us,
        R.drawable.page_menu_personal_profile,
        R.drawable.page_menu_your_advice,
        R.drawable.page_menu_privacy_policy,
        R.drawable.page_menu_setting,
        R.drawable.page_menu_exit
    )

    //菜单列表
    private val menuList = arrayListOf<JSONObject>()

    /**
     * 加载菜单列表
     */
    fun getMenuList(){
        //tab
        for (i in 0 until menuStr.size) {
            val menu = JSONObject()
            menu.put("menuId", i)
            menu.put("menuTitle", menuStr[i])
            menu.put("menuIcon", menuIcon[i])
            menu.put("menuValue", "")
            menuList.add(menu)
        }
        iView.showMenuList(menuList)
    }
}